#########################################################################
# File Name: a.sh
# Author: Thinking
# mail: program_code@sohu.com 
# Created Time: Fri 11 Nov 2022 02:02:24 AM CST
#########################################################################
#!/bin/bash

BIN_FOLDER=$(cd "$(dirname "$0")";pwd)
echo $BIN_FOLDER

cd $BIN_FOLDER

format_dir()
{
    for file in `ls $1`

    do
        if [ -d $1"/"$file ] 
        then
            format_dir $1"/"$file
        else
			
			if [ ${file##*/} = 'resource.h' ]; then

				echo "windows res drop file" $1"/"$file

			else

				if [ ${file##*.} = 'hpp' ] || 
					[ ${file##*.} = 'h' ] || 
					[ ${file##*.} = 'cpp' ] || 
					[ ${file##*.} = 'c' ]; then

					clang-format -style=file -i $1"/"$file
					echo $1"/"$file
				fi
			fi

        fi
    done
}


format_dir

#format_dir_all()
#{
	format_dir $BIN_FOLDER"/asynio/"
	format_dir $BIN_FOLDER"/access/"
	format_dir $BIN_FOLDER"/container/"
	format_dir $BIN_FOLDER"/crt/"
	format_dir $BIN_FOLDER"/dispatch"
	format_dir $BIN_FOLDER"/extensions/"
	format_dir $BIN_FOLDER"/include/"
	format_dir $BIN_FOLDER"/license/"
	format_dir $BIN_FOLDER"/logs/"
	format_dir $BIN_FOLDER"/main/"
	format_dir $BIN_FOLDER"/mainview/"
	format_dir $BIN_FOLDER"/mainui/"
	format_dir $BIN_FOLDER"/mainuiapp/"
	format_dir $BIN_FOLDER"/mainview/"
	format_dir $BIN_FOLDER"/msgbus/"
	format_dir $BIN_FOLDER"/net/"
	format_dir $BIN_FOLDER"/nettls/"
	format_dir $BIN_FOLDER"/plugin/"
	format_dir $BIN_FOLDER"/polipo/"
	format_dir $BIN_FOLDER"/runtime/"
	format_dir $BIN_FOLDER"/stdcom_tool/"
	format_dir $BIN_FOLDER"/stdcrt/"
	format_dir $BIN_FOLDER"/stdcrt_test/"
	format_dir $BIN_FOLDER"/testmain/"
	format_dir $BIN_FOLDER"/uibase/"
#}





